package com.example.project.projectspringcloud.dao.video;

import com.example.project.projectspringcloud.dao.BaseMapper;
import com.example.project.projectspringcloud.entity.video.Video;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import javax.validation.constraints.NotNull;
import java.util.List;
import java.util.Set;

@Mapper
@Repository
public interface VideoMapper extends BaseMapper<Video> {

    Set<Integer> selectAllVideoUrl(Video entity);

    /**
     * 根据用户ID删除
     * ==============================================================================
     *
     * @param userId
     * @return
     */
    int deleteByUser(@Param("userId") Integer userId);

    /**
     * select count by production
     *
     * @param video
     * @return
     */
    int selectCount(Video video);

    /**
     * 通过ids获取全部
     * ==============================================================================
     *
     * @param ids
     * @return
     */
    List<Video> selectAllByIdsAndType(@Param("ids") Set<Integer> ids, @Param("type") Integer type);

    /**
     * 更新作品播放量
     *
     * @param id
     * @param count
     * @return
     */
    int updateCount(@NotNull @Param("id") Integer id, @NotNull @Param("count") Integer count);
}